|
|
|
|
|
|
|
Set pr = Nothing
Set rs = Nothing
Set qd = Nothing
Set db = Nothing
Set ws = Nothing
'
Exit Sub
'
LocalErr:
strMsg = strMsg & "<err>"
Resume Next
'
End Sub |
|
|
|
|
|
|
|
|
Notice that this code creates and executes two QueryDefs. The first query is an action queryit uses the Execute method. Note also that this first query was never assigned a value for the Name property. It is treated as a temporary query by Microsoft Jet, and it is not appended to the QueryDefs collection. |
|
|
|
|
|
|
|
|
The second QueryDef selects records from the data table. Because this is not an action query, the OpenRecordset method is used to perform this query. Also, because this query was given a value for the Name property, it is appended automatically to the QueryDefs collection and saved with the database. |
|
|
|
|
|
|
|
|
Now save and run this code. You see the now familiar CreateTable dialog followed by two more dialogs. The first is the property list for the temporary query. Note that the Name property has been filled by Microsoft Jet with #Temporary QueryDef# and that the RecordsAffected property has been set to 1 (see Figure 9.20). |
|
|
|
|
|
|
|
|
Figure 9.20.
Viewing the property list for
a temporary QueryDef. |
|
|
|
|
|
|
|
|
The next dialog is the property list for the saved QueryDef. This query pulls data from the table into a programming object. Note that the DateCreated and LastUpdated properties are set to valid values (see Figure 9.21). |
|
|
|
|
|